PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Errors

Commands can return error messages as well as results. An error message is a message that is returned by an application, AppleScript, or the operating system if an error occurs during the handling of a command. The "Errors" section of a command definition, if present, lists errors that are likely to be returned by a particular command. This information can help you decide if you need to write error handlers to respond to the error messages that are returned. Error handlers are described in Handlers.

Some "errors" are not the result of abnormal conditions but are the normal way you get information about what happened during command execution. For example, you use the Choose File scripting addition command to ask the user to choose a file. When AppleScript executes this command, it displays a dialog box similar to the one you get when you choose Open from the File menu. If the user presses the Cancel button in the dialog box, AppleScript returns error number -128 and the error string "User canceled" . Your script must handle this error for script execution to continue.

For a complete description of handling errors that occur during script execution, see Handlers .


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)